<table class="table table-striped table-bordered table-hover history_version_table" id="history_version_table">
    <thead></thead>
    <tbody></tbody>
</table>

<script>


    var table ;


    $(function() {

        table = $('#history_version_table').dataTable({
            "processing": true,
            "serverSide": true,
            "searching": true,
            "columns": [
                {"title": "序号", "orderable": false, "data": null},
                {"title": "提交用户", "orderable": false, "data": 'username'},
                {"title": "版本号", "orderable": false, "data": 'version'},
                {"title": "说明", "orderable": false, "data": 'remark'},
                {"title": "当前语言版本信息", "orderable": false, "data": 'lang_version_info'},
                {"title": "提交语言", "orderable": false, "data": 'submit_lang'},
                {"title": "提交时间", "orderable": true, "data": "createtime"},
                {"title": "操作", "orderable": false, "data": null},

            ],

            columnDefs: [{
                targets: 7,
                render: function (data, type, row, meta) {
                    return '<button type="button"  class="btn btn-info btn-xs btn-edit"   onclick="show_history_version('+row.id+')" ><i class="fa fa-pencil"></i>查看</button> ';
                }
            },

            ],


            "ajax": {
                "url": "<?= base_url('admin/version/project_version') ?>",
                "data": function (d) {
                    d.pid = <?= $project['id']?> ;
                },
                "type": "POST"
            },

            "fnDrawCallback": function () {
                var api = this.api();
                var startIndex = api.context[0]._iDisplayStart;//获取到本页开始的条数
                api.column(0).nodes().each(function (cell, i) {
                    cell.innerHTML = startIndex + i + 1;
                });
            },

            "initComplete": function (settings, json) {

            }
        });
    });


 </script>